<?php

class Constant
{
    // 错误码 *****************
    const SUCCESS              = 0;
    const FAILED               = -1;
    const SYSTEM_TYPE_EMPTY    = 101;
    const SYSTEM_VERSION_EMPTY = 102;
    const TOKEN_EMPTY          = 103;
    const TOKEN_ERROR          = 104;
    const TOKEN_EXPIRED        = 105;
    const NEED_LOGIN           = 106;
    const RISK_CHECK           = 107;
    const PARAM_ERROR          = 108;
    const SIGN_ERROR           = 109;

    const IMAGE_CAPTCHA_ERROR  = 110;
    const MOBILE_CAPTCHA_ERROR = 111;
    const MOBILE_ERROR         = 112;

    const GOODS_NO_STOCK       = 120;

    const NEED_SHOW_MESSAGE    = 199;

    const MESSAGE = [
        Constant::SUCCESS => '',
        Constant::FAILED => '出现未知错误，请联系客服',
        Constant::SYSTEM_TYPE_EMPTY => 'system-type为空，非法操作',
        Constant::SYSTEM_VERSION_EMPTY => 'system-version为空，非法操作',
        Constant::TOKEN_EMPTY => 'token为空，非法操作',
        Constant::TOKEN_ERROR => '请重新登陆',
        Constant::TOKEN_EXPIRED => '登录失效，请重新登陆',
        Constant::NEED_LOGIN => '请先登录',
        Constant::RISK_CHECK => '需要风险验证',
        Constant::PARAM_ERROR => '参数错误',
        Constant::SIGN_ERROR => '签名错误',

        Constant::IMAGE_CAPTCHA_ERROR => '图片验证码错误或过期，请重新验证',
        Constant::MOBILE_CAPTCHA_ERROR => '手机验证码错误或过期，请重新验证',
        Constant::MOBILE_ERROR => '手机号格式不正确，请重新输入',

        Constant::GOODS_NO_STOCK => '已经抢光了，下次还有机会，积分+1', // 积分加1个

        Constant::NEED_SHOW_MESSAGE => '',

    ];

    static function getMsg($status) {
        return Constant::MESSAGE[$status];
    }
}